/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Deviant
 */
@Entity
@Table(name = "functionrole", catalog = "mysweethome", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Functionrole.findAll", query = "SELECT f FROM Functionrole f"),
    @NamedQuery(name = "Functionrole.findByFunctionroleid", query = "SELECT f FROM Functionrole f WHERE f.functionroleid = :functionroleid"),
    @NamedQuery(name = "Functionrole.findByDescription", query = "SELECT f FROM Functionrole f WHERE f.description = :description")})
public class Functionrole implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "functionroleid", nullable = false)
    private Integer functionroleid;
    @Size(max = 50)
    @Column(name = "description", length = 50)
    private String description;
    @JoinColumn(name = "role_id", referencedColumnName = "role_id", nullable = false)
    @ManyToOne(optional = false)
    private Role roleId;
    @JoinColumn(name = "functionid", referencedColumnName = "function_id", nullable = false)
    @ManyToOne(optional = false)
    private Function functionid;

    public Functionrole() {
    }

    public Functionrole(Integer functionroleid) {
        this.functionroleid = functionroleid;
    }

    public Integer getFunctionroleid() {
        return functionroleid;
    }

    public void setFunctionroleid(Integer functionroleid) {
        this.functionroleid = functionroleid;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Role getRoleId() {
        return roleId;
    }

    public void setRoleId(Role roleId) {
        this.roleId = roleId;
    }

    public Function getFunctionid() {
        return functionid;
    }

    public void setFunctionid(Function functionid) {
        this.functionid = functionid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (functionroleid != null ? functionroleid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Functionrole)) {
            return false;
        }
        Functionrole other = (Functionrole) object;
        if ((this.functionroleid == null && other.functionroleid != null) || (this.functionroleid != null && !this.functionroleid.equals(other.functionroleid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "app.entity.Functionrole[ functionroleid=" + functionroleid + " ]";
    }
    
}
